<template>
  <el-menu
    router
    :default-active="activeIndex"
    unique-opened
    class="el-menu-vertical-demo">
    <el-submenu index="1">
      <template slot="title">
        <i class="el-icon-location"></i>
        <span>Base</span>
      </template>
      <el-menu-item-group>
        <el-menu-item index="/elementui/bases/layouts/index">Layout布局</el-menu-item>
      </el-menu-item-group>
    </el-submenu>
    <el-submenu index="2">
      <template slot="title">
        <i class="el-icon-location"></i>
        <span>Form</span>
      </template>
      <el-menu-item-group>
        <el-menu-item index="/elementui/forms/selects/index">Select 选择器</el-menu-item>
        <el-menu-item index="1-2">选项2</el-menu-item>
      </el-menu-item-group>
    </el-submenu>
    <el-submenu index="3">
      <template slot="title">
        <i class="el-icon-location"></i>
        <span>Data</span>
      </template>
      <el-menu-item-group>
      </el-menu-item-group>
    </el-submenu>
    <el-submenu index="5">
      <template slot="title">
        <i class="el-icon-location"></i>
        <span>Navigation</span>
      </template>
      <el-menu-item-group>
      </el-menu-item-group>
    </el-submenu>
    <el-submenu index="6">
      <template slot="title">
        <i class="el-icon-location"></i>
        <span>Others</span>
      </template>
      <el-menu-item-group>
        <el-menu-item index="/elementui/others/drawers/index">Drawer 抽屉</el-menu-item>
      </el-menu-item-group>
    </el-submenu>
  </el-menu>
</template>

<script>
    export default {
        name: 'LeftNavMenu',
        data() {
            return {
                activeIndex: '/elementui/select',
            };
        },
        mounted() {
            this.activeIndex = this.$route.path
        }
    }
</script>

<style>
  .el-submenu.is-active {
    background-color: #eee;
  }

  .el-menu-item.is-active {
    background-color: #eee !important;
  }

  .el-menu-item:hover, .el-submenu__title:hover {
    background-color: #eee !important;
  }

</style>
